<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="script-tags-for-development.js"></script>
<script>
var app = angular.module('myApp', ['ngMap']);
app.controller('MyController', function(NgMap) {
  var map;
  var vm = this;
  NgMap.getMap().then(function(evtMap) {
    map = evtMap;
  });
  vm.latlng = [40.741, -74.181];
  vm.radius = 3500;
  vm.getRadius = function(event) {
    alert('this circle has radius ' + this.getRadius());
  }
  vm.setCenter = function(event) {
    console.log('event', event);
    map.setCenter(event.latLng);
  }
  vm.foo = function(event, arg1, arg2) {
    alert('this is at '+ this.getPosition());
    alert(arg1+arg2);
  }
  vm.dragStart = function(event) {
    console.log("drag started");
  }
  vm.drag = function(event) {
    console.log("dragging");
  }
  vm.dragEnd = function(event) {
    console.log("drag ended");
  }
});
</script>
</head>

<body ng-controller="MyController as vm">
  Events are applied to map, markers, and shapes.
  <br/>
  All event-related attributes are preceded by 'on-', i.e. on-click, on-mouseover, etc
  <br/>
  <br/>
  <ng-map zoom="11" center="{{vm.latlng}}" on-click="vm.setCenter(event)" tilt="0">
    <marker position="[40.79, -74.20]" on-click="vm.foo(2,3)"></marker>
    <shape name="circle" stroke-color='#FF0000' stroke-weight="2"
      center="{{vm.latlng}}" radius="{{vm.radius}}"
      on-click="vm.getRadius()"
      draggable="true"
      on-dragstart="vm.dragStart()"
      on-drag="vm.drag()"
      on-dragend="vm.dragEnd()">
    </shape>
  </ng-map>
</body>
</html>
